package conf

import (
	"generalhandler/utils"
	"path"
	"fmt"
)

type PortMapConfig struct {
	Map map[string][]string `json:"map"`
	Prefix map[string]string `json:"prefix"`
}

var pmc *PortMapConfig
func PortMapInstance() *PortMapConfig {
	return pmc
}

func LoadPortMapConf() {
	path := path.Join(utils.GetSelfBinDirPath(), "portmap.config")
	if err := utils.LoadJsonFromFile(path, &pmc); nil != err {
		panic(fmt.Sprintf("failed to load portmap config, cuz %s", err.Error()))
	}
}
